package com.hns.can.safety.web;

import com.hns.can.common.domain.GridPage;
import com.hns.can.common.web.BaseController;
import com.hns.can.mainte.vo.LoadFileParamVo;
import com.hns.can.safety.entity.CommSctDobPoitInfoEntity;
import com.hns.can.safety.service.DrvSctBlackspotService;
import com.hns.frame.mybatis.Pagination;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 行为疑点
 *
 * @author xujf
 * @email 835264047@qq.com
 */
@Controller
@RequestMapping("/drvSctBlackspot")
public class DrvSctBlackspotController extends BaseController {

    @Autowired
    private DrvSctBlackspotService drvSctBlackspotService;

    /**
     * 查询行为列表（5种行为）
     * 超速,急加速,急减速,急刹,起步急加速
     *
     * @param searchParams
     * @param request
     * @param response
     * @throws Exception
     */
    @RequestMapping("/getDrvSctBhvPage")
    @ResponseBody
    public Object searchDrvSctBhvPage(LoadFileParamVo params, HttpServletRequest request,
                                      HttpServletResponse response) throws Exception {
        params.setDriverRelTableName("V_CLN_DRV_SCT_BHV");
        Pagination page = drvSctBlackspotService.getDrvSctBlackspotPage(params);
        GridPage grid = new GridPage(page);
        return this.getReturnResult(grid);
    }

    /**
     * 获取行为疑点报表数据
     *
     * @param params
     * @param request
     * @param response
     * @throws Exception
     */
    @RequestMapping("/getDrvSctBlackspotChart")
    @ResponseBody
    public Object getDrvSctBlackspotChart(LoadFileParamVo params,
                                          HttpServletRequest request, HttpServletResponse response) throws Exception {
        List<CommSctDobPoitInfoEntity> list = drvSctBlackspotService.getDrvSctBlackspotChart(params);
        return this.getReturnResult(list);
    }

}
